﻿using System;
using System.Windows.Controls;
using Oxage.Rasterizer.Models;
using System.Windows;

namespace Oxage.Rasterizer.Views
{
	public partial class RasterView : UserControl
	{
		#region Constructor
		public RasterView()
		{
			InitializeComponent();

			try
			{
				theme.MergedDictionaries.Clear();
#if BLEND4
				//Avoid conflicts with ComboBox style in Expression Blend 4
				theme.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri("/Oxage.Rasterizer.Control;component/Resources/ExpressionThemeForBlend4.xaml", UriKind.Relative) });
#else
				//Default ComboBox style is set in ExpressionTheme.xaml
				theme.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri("/Oxage.Rasterizer.Control;component/Resources/ExpressionTheme.xaml", UriKind.Relative) });
#endif
				theme.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri("/Oxage.Rasterizer.Control;component/Resources/Styles.xaml", UriKind.Relative) });
			}
			catch (Exception ex)
			{
				if (Settings.Debug)
				{
					MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK);
				}
			}
		}
		#endregion

		#region Public properties
		public RasterViewModel ViewModel
		{
			get
			{
				return this.DataContext as RasterViewModel;
			}
		}
		#endregion
	}
}
